Kameleon-Plus  0.3.2
Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
ccmc::Model Class Referenceabstract

TODO: Brief description of Model class. More...

#include <ccmc/Model.h>

Inheritance diagram for ccmc::Model:
Inheritance graph
[legend]
Collaboration diagram for ccmc::Model:
Collaboration graph
[legend]

Public Member Functions

 Model ()
 
virtual long open (const std::string &filename)=0
 Opens a file.
 
void setModelName (std::string modelName)
 Sets the model name to modelName.
 
std::string getModelName ()
 Returns the modelName of the currently selected file.
 
long loadVariable (const std::string &variable)
 Load a variable into memory.
 
long unloadVariable (const std::string &variable)
 Unload a variable from memory. This will return FileReader::OK if the variable is removed from memory, and FileReader::VARIABLE_NOT_IN_MEMORY if the variable was not already in memory.
 
long loadVariableInt (const std::string &variable)
 Loads a variable into memory.
 
std::vector< float > * getVariableFromMapRW (const std::string &variable)
 Returns a pointer to the entry in the variableData map containing the variable data.
 
std::vector< int > * getIntVariableFromMapRW (const std::string &variable)
 Returns a pointer to the entry in the variableDataInt map containing the variable data.
 
const std::vector< float > *const getVariableFromMap (const std::string &variable)
 Returns a const pointer to the entry in the variableData map containing the variable data.
 
const std::vector< int > *const getIntVariableFromMap (const std::string &variable)
 Returns a const pointer to the entry in the variableDataInt map containing the variable data.
 
void addFloatVariableToMap (const std::string &variable, std::vector< float > *variableData)
 
const std::vector< float > *const getVariableFromMap (long variable_id)
 Returns a const pointer to the entry in the variableDataByID map containing the variable data.
 
const std::vector< int > *const getIntVariableFromMap (long variable_id)
 Returns a const pointer to the entry in the variableDataIntByID map containing the variable data.
 
std::vector< float > * getVariableFromMapRW (long variable_id)
 Returns a pointer to the entry in the variableDataByID map containing the variable data.
 
std::vector< int > * getIntVariableFromMapRW (long variable_id)
 Returns a pointer to the entry in the variableDataIntByID map containing the variable data.
 
virtual const std::vector
< std::string > 
getLoadedVariables ()
 Returns the list of variables that have been loaded into memory, using the loadVariable or loadVectorVariable methods.
 
void setMissingValue (float missingValue)
 Sets the missing value to use when no valid data exists.
 
float getMissingValue ()
 Returns the missing value that will be returned when no valid data exists.
 
float getConversionFactorToSI (const std::string &variable)
 Returns the conversion factor needed to convert the interpolated value to SI units.
 
std::string getNativeUnit (const std::string &variable)
 Fetches the native units of the variable as stored in the file.
 
std::string getSIUnit (const std::string &variable)
 Returns the SI units of the specified variable.
 
int getProgress ()
 
int getBusyStatus ()
 
long close ()
 Closes the currently selected file.
 
virtual InterpolatorcreateNewInterpolator ()=0
 Returns an Interpolator object for the currently opened file.
 
virtual ~Model ()
 
- Public Member Functions inherited from ccmc::GeneralFileReader
 GeneralFileReader ()
 
long open (const std::string &filename)
 
std::vector< float > * getVariable (const std::string &variable)
 
std::vector< float > * getVariable (long variableID)
 
std::vector< float > * getVariable (const std::string &variable, long startIndex, long count)
 
std::vector< float > * getVariable (long variableID, long startIndex, long count)
 
float getVariableAtIndex (const std::string &variable, long index)
 
float getVariableAtIndex (long variable_id, long index)
 
std::vector< int > * getVariableInt (const std::string &variable)
 
int getVariableIntAtIndex (const std::string &variable, long index)
 
int getNumberOfGlobalAttributes ()
 
int getNumberOfVariables ()
 
int getNumberOfVariableAttributes ()
 
long getNumberOfRecords (const std::string &variable)
 
long getNumberOfRecords (long variable_id)
 
long getVariableID (const std::string &variable)
 
std::string getVariableName (long variable_id)
 
Attribute getGlobalAttribute (long i)
 
std::string getGlobalAttributeName (long attribute_id)
 
std::string getVariableAttributeName (long attribute_id)
 
Attribute getGlobalAttribute (const std::string &attribute)
 
Attribute getVariableAttribute (const std::string &variable, const std::string &attribute)
 
std::vector< std::string > getVariableAttributeNames ()
 
bool doesAttributeExist (const std::string &attribute)
 
bool doesVariableExist (const std::string &variable)
 
long close ()
 
const std::string & getCurrentFilename ()
 
 ~GeneralFileReader ()
 

Static Public Attributes

static const int BUSY =1
 
static const int OK =2
 

Protected Types

typedef boost::unordered_map
< std::string, std::vector
< float > * > 
mapStringFloat
 
typedef boost::unordered_map
< std::string, std::vector
< int > * > 
mapStringInt
 
typedef boost::unordered_map
< long, std::vector< float > * > 
mapLongFloat
 
typedef boost::unordered_map
< long, std::vector< int > * > 
mapLongInt
 

Protected Member Functions

virtual void initializeConversionFactorsToSI ()=0
 Initializes the conversionFactorsToSI map.
 
void setBusyStatus (int busyStatus)
 
virtual void initializeSIUnits ()=0
 Initializes the variableSIUnits map.
 
- Protected Member Functions inherited from ccmc::GeneralFileReader
void initializeGlobalAttributes ()
 
void initializeVariableAttributes ()
 
void initializeVariableIDs ()
 
void initializeVariableNames ()
 

Protected Attributes

std::string modelName
 
boost::unordered_map
< std::string, float > 
conversionFactorsToSI
 
boost::unordered_map
< std::string, std::string > 
variableSIUnits
 
boost::unordered_map
< std::string, std::vector
< float > * > 
variableData
 
boost::unordered_map
< std::string, std::vector
< int > * > 
variableDataInt
 
boost::unordered_map< long,
std::vector< float > * > 
variableDataByID
 
boost::unordered_map< long,
std::vector< int > * > 
variableDataIntByID
 
std::string units_
 
float missingValue
 
int busyStatus
 
int progress
 
int variablesAdded
 
- Protected Attributes inherited from ccmc::GeneralFileReader
std::string current_filename
 
boost::unordered_map
< std::string, long > 
variableIDs
 
boost::unordered_map< long,
std::string > 
variableNames
 
boost::unordered_map
< std::string, Attribute
gAttributes
 
boost::unordered_map< long,
Attribute
gAttributeByID
 
boost::unordered_map
< std::string,
boost::unordered_map
< std::string, Attribute > > 
vAttributes
 
FileReaderfileReader
 

Detailed Description

TODO: Brief description of Model class.

TODO: Full description of Model class

Member Typedef Documentation

typedef boost::unordered_map<long, std::vector<float>*> ccmc::Model::mapLongFloat
protected
typedef boost::unordered_map<long, std::vector<int>*> ccmc::Model::mapLongInt
protected
typedef boost::unordered_map<std::string, std::vector<float>*> ccmc::Model::mapStringFloat
protected
typedef boost::unordered_map<std::string, std::vector<int>*> ccmc::Model::mapStringInt
protected

Constructor & Destructor Documentation

ccmc::Model::Model ( )

Default constructor

ccmc::Model::~Model ( )
virtual

Destructor

Member Function Documentation

void ccmc::Model::addFloatVariableToMap ( const std::string &  variable,
std::vector< float > *  variableData 
)
long ccmc::Model::close ( )

Closes the currently selected file.

Returns

Here is the call graph for this function:

virtual Interpolator* ccmc::Model::createNewInterpolator ( )
pure virtual

Returns an Interpolator object for the currently opened file.

This returns an Interpolator object that contains all the necessary local variables required to interpolate independent of any other Interpolator object. The pointer must be deleted from the calling program.

Returns
A pointer to an Interpolator object.

Implemented in ccmc::Adapt3D, ccmc::OpenGGCM, ccmc::BATSRUS, ccmc::CTIP, ccmc::LFM, ccmc::ENLIL, ccmc::Magnetogram, ccmc::MAS, and ccmc::SWMFIono.

int ccmc::Model::getBusyStatus ( )
float ccmc::Model::getConversionFactorToSI ( const std::string &  variable)

Returns the conversion factor needed to convert the interpolated value to SI units.

Parameters
variableVariable to request the conversion factor for.
Returns
Conversion factor to convert the specified variable to SI units
const std::vector< int > *const ccmc::Model::getIntVariableFromMap ( const std::string &  variable)

Returns a const pointer to the entry in the variableDataInt map containing the variable data.

This pointer cannot be modified.

Parameters
variableVariable to fetch from memory. This assumes the variable has already been loaded into memory. If the variable has not been loaded, the pointer will be NULL.
Returns
std::vector<int>* of the requested variable. Note that the pointer points to an entry in a map and should not and cannot be deleted. The memory pointed to by the pointer will automatically be freed when the file is closed, or the Model object is deleted.
const std::vector< int > *const ccmc::Model::getIntVariableFromMap ( long  variable_id)

Returns a const pointer to the entry in the variableDataIntByID map containing the variable data.

This pointer cannot be modified.

Parameters
variable_idVariable id of the variable to fetch from memory. This assumes the variable has already been loaded into memory. If the variable has not been loaded, the pointer will be NULL. Request the variable id by using FileReader::getVariableID(const std::string& variable)
Returns
std::vector<int>* of the requested variable. Note that the pointer points to an entry in a map and should not and cannot be deleted. The memory pointed to by the pointer will automatically be freed when the file is closed, or the Model object is deleted.
std::vector< int > * ccmc::Model::getIntVariableFromMapRW ( const std::string &  variable)

Returns a pointer to the entry in the variableDataInt map containing the variable data.

This pointer cannot be modified.

Parameters
variableVariable to fetch from memory. This assumes the variable has already been loaded into memory. If the variable has not been loaded, the pointer will be NULL.
Returns
std::vector<int>* of the requested variable. Note that the pointer points to an entry in a map. The memory pointed to by the pointer will automatically be freed when the file is closed, or the Model object is deleted.
std::vector< int > * ccmc::Model::getIntVariableFromMapRW ( long  variable_id)

Returns a pointer to the entry in the variableDataIntByID map containing the variable data.

This pointer cannot be modified.

Parameters
variable_idVariable id of the variable to fetch from memory. This assumes the variable has already been loaded into memory. If the variable has not been loaded, the pointer will be NULL. Request the variable id by using FileReader::getVariableID(const std::string& variable)
Returns
std::vector<int>* of the requested variable. Note that the pointer points to an entry in a map. The memory pointed to by the pointer will automatically be freed when the file is closed, or the Model object is deleted.
const std::vector< std::string > ccmc::Model::getLoadedVariables ( )
virtual

Returns the list of variables that have been loaded into memory, using the loadVariable or loadVectorVariable methods.

Reimplemented in ccmc::Adapt3D, ccmc::MAS, ccmc::OpenGGCM, ccmc::BATSRUS, ccmc::ENLIL, and ccmc::SWMFIono.

float ccmc::Model::getMissingValue ( )

Returns the missing value that will be returned when no valid data exists.

This value can be used to check whether an interpolated value is a missing value or not.

Returns
Missing value
std::string ccmc::Model::getModelName ( )

Returns the modelName of the currently selected file.

Returns
std::string ccmc::Model::getNativeUnit ( const std::string &  variable)

Fetches the native units of the variable as stored in the file.

Parameters
variableVariable to request units for.
Returns
The native units of the specified variable, as stored in the file.
int ccmc::Model::getProgress ( )
std::string ccmc::Model::getSIUnit ( const std::string &  variable)

Returns the SI units of the specified variable.

Parameters
variable
Returns
const std::vector< float > *const ccmc::Model::getVariableFromMap ( const std::string &  variable)

Returns a const pointer to the entry in the variableData map containing the variable data.

This pointer cannot be modified.

Parameters
variableVariable to fetch from memory. This assumes the variable has already been loaded into memory. If the variable has not been loaded, the pointer will be NULL.
Returns
std::vector<float>* of the requested variable. Note that the pointer points to an entry in a map and should not and cannot be deleted. The memory pointed to by the pointer will automatically be freed when the file is closed, or the Model object is deleted.
const std::vector< float > *const ccmc::Model::getVariableFromMap ( long  variable_id)

Returns a const pointer to the entry in the variableDataByID map containing the variable data.

This pointer cannot be modified.

Parameters
variable_idVariable id of the variable to fetch from memory. This assumes the variable has already been loaded into memory. If the variable has not been loaded, the pointer will be NULL. Request the variable id by using FileReader::getVariableID(const std::string& variable)
Returns
std::vector<float>* of the requested variable. Note that the pointer points to an entry in a map and should not and cannot be deleted. The memory pointed to by the pointer will automatically be freed when the file is closed, or the Model object is deleted.
std::vector< float > * ccmc::Model::getVariableFromMapRW ( const std::string &  variable)

Returns a pointer to the entry in the variableData map containing the variable data.

This pointer can be modified.

Parameters
variableVariable to fetch from memory. This assumes the variable has already been loaded into memory. If the variable has not been loaded, the pointer will be NULL.
Returns
std::vector<float>* of the requested variable. Note that the pointer points to an entry in a map. The memory pointed to by the pointer will automatically be freed when the file is closed, or the Model object is deleted.
std::vector< float > * ccmc::Model::getVariableFromMapRW ( long  variable_id)

Returns a pointer to the entry in the variableDataByID map containing the variable data.

This pointer cannot be modified.

Parameters
variable_idVariable id of the variable to fetch from memory. This assumes the variable has already been loaded into memory. If the variable has not been loaded, the pointer will be NULL. Request the variable id by using FileReader::getVariableID(const std::string& variable)
Returns
std::vector<float>* of the requested variable. Note that the pointer points to an entry in a map. The memory pointed to by the pointer will automatically be freed when the file is closed, or the Model object is deleted.
virtual void ccmc::Model::initializeConversionFactorsToSI ( )
protectedpure virtual

Initializes the conversionFactorsToSI map.

These factors are used to convert interpolated values to SI units.

Implemented in ccmc::Adapt3D, ccmc::OpenGGCM, ccmc::MAS, ccmc::LFM, ccmc::BATSRUS, ccmc::ENLIL, ccmc::CTIP, ccmc::Magnetogram, and ccmc::SWMFIono.

virtual void ccmc::Model::initializeSIUnits ( )
protectedpure virtual

Initializes the variableSIUnits map.

Implemented in ccmc::Adapt3D, ccmc::OpenGGCM, ccmc::MAS, ccmc::LFM, ccmc::BATSRUS, ccmc::ENLIL, ccmc::CTIP, ccmc::Magnetogram, and ccmc::SWMFIono.

long ccmc::Model::loadVariable ( const std::string &  variable)

Load a variable into memory.

Use this method when the variable to load is of type float

Parameters
variableVariable to load into memory.
Returns
status of the operation

Here is the call graph for this function:

long ccmc::Model::loadVariableInt ( const std::string &  variable)

Loads a variable into memory.

Use this method when the variable to load is of type int

Parameters
variable
Returns
status of the operation

Here is the call graph for this function:

virtual long ccmc::Model::open ( const std::string &  filename)
pure virtual

Opens a file.

Opens a file and performs any necessary initialization required to work with the data.

Parameters
filename

Implemented in ccmc::Adapt3D, ccmc::BATSRUS, ccmc::CTIP, ccmc::LFM, ccmc::OpenGGCM, ccmc::ENLIL, ccmc::Magnetogram, ccmc::MAS, and ccmc::SWMFIono.

void ccmc::Model::setBusyStatus ( int  busyStatus)
protected
void ccmc::Model::setMissingValue ( float  missingValue)

Sets the missing value to use when no valid data exists.

Parameters
missingValue
void ccmc::Model::setModelName ( std::string  modelName)

Sets the model name to modelName.

Parameters
modelName
long ccmc::Model::unloadVariable ( const std::string &  variable)

Unload a variable from memory. This will return FileReader::OK if the variable is removed from memory, and FileReader::VARIABLE_NOT_IN_MEMORY if the variable was not already in memory.

Parameters
variableVariable to unload from memory.
Returns
status of the operation

Here is the call graph for this function:

Member Data Documentation

const int ccmc::Model::BUSY =1
static
int ccmc::Model::busyStatus
protected
boost::unordered_map<std::string, float> ccmc::Model::conversionFactorsToSI
protected
float ccmc::Model::missingValue
protected
std::string ccmc::Model::modelName
protected
const int ccmc::Model::OK =2
static
int ccmc::Model::progress
protected
std::string ccmc::Model::units_
protected
boost::unordered_map<std::string, std::vector<float>*> ccmc::Model::variableData
protected
boost::unordered_map<long, std::vector<float>*> ccmc::Model::variableDataByID
protected
boost::unordered_map<std::string, std::vector<int>*> ccmc::Model::variableDataInt
protected
boost::unordered_map<long, std::vector<int>*> ccmc::Model::variableDataIntByID
protected
int ccmc::Model::variablesAdded
protected
boost::unordered_map<std::string, std::string> ccmc::Model::variableSIUnits
protected

The documentation for this class was generated from the following files: